<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="zh-CN">
<head>
	<meta charset="UTF-8">
	<title><?php echo ('[title]' == '['.'title'.']' ? C('WEBSITE_NAME') : '[title]');?></title>
	<meta name="viewport" content="initial-scale=1, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
    <meta content="yes" name="apple-mobile-web-app-capable">
	<meta content="red" name="apple-mobile-web-app-status-bar-style">
	<meta name="format-detection" content="telphone=no">
	<link rel="stylesheet" href="/css/mall.css?modify=20161026">
	<link rel="stylesheet" href="/css/trade.css?modify=20161026">
	<link rel="stylesheet" href="/css/red.css">
	<script type="text/javascript">
	var require = {
		baseUrl: '/js',
		waitSeconds: 0,
		map: {
		  '*': {
			'css': '//cdn.bootcss.com/require-css/0.1.8/css.min.js',
			'text': '//cdn.bootcss.com/require-text/2.0.12/text.min.js'
		  }
		},
		shim: {
			swiper: ['jquery', 'css!//cdn.bootcss.com/Swiper/3.3.1/css/swiper.min.css'],
			lazyload: ['jquery'],
		},
		paths: {
            'jquery': '//cdn.bootcss.com/jquery/1.12.4/jquery.min',
			'template': 'template',
			'validatejs': '//cdn.bootcss.com/jquery-validate/1.15.0/jquery.validate.min',
			'weixinjs': 'https://res.wx.qq.com/open/js/jweixin-1.0.0',
			'lazyload': '//cdn.bootcss.com/jquery.lazyload/1.9.1/jquery.lazyload.min',
			'swiper': '//cdn.bootcss.com/Swiper/3.3.1/js/swiper.min',

			'mall/cart': 'h5.js?modify=20161026',
			'view/order/list': 'h5.js?modify=20161026',
			'view/balance': 'h5.js?modify=20161026',
			'module/cart/num': 'h5.js?modify=20161026',
			'order/address': 'h5.js?modify=20161026',
			'pay': 'h5.js?modify=20161026',
			'view/personal/edit': 'h5.js?modify=20161026',
			'view/personal/scoreDetail': 'h5.js?modify=20161026',
			'view/present/list': 'h5.js?modify=20161026',
			'view/score': 'h5.js?modify=20161026',
			'pay/express': 'h5.js?modify=20161026',
			'jsweixin': 'h5.js?modify=20161026',
			'skumodal': 'h5.js?modify=20161026',
			'customer_service': 'h5.js?modify=20161026',
			'order/refund': 'h5.js?modify=20161026',
			'model_pay_coupon': 'h5.js?modify=20161026',
			'login_modal': 'h5.js?modify=20161026',
			'member/collection': 'h5.js?modify=20161026',
            'pullfresh': 'h5.js?modify=20161026',
            'goods_list': 'h5.js?modify=20161026',
          	'search': 'h5.js?modify=20161026',
		}
	}
	</script>
	<?php if(IS_APP): ?><script type="text/javascript" src="/js/appcan.min.js"></script><?php endif; ?>
	<script data-main="/js/h5.js?modify=20161026" src="//cdn.bootcss.com/require.js/2.3.1/require.min.js"></script>
	<?php if(!APP_DEBUG){ require_once 'cs.php';echo '<img src="'._cnzzTrackPageView(1259294058).'" width="0" height="0" style="display:none;"/>'; } ?>
</head>
<body class="body-fixed-bottom">
	<div class="container js-page-content wap-page-order">
		<div class="content confirm-container">
			<div class="seller-state  " style="background:#ff7e00 /*url(/img/order/<?php echo ($trade["status"]); ?>.png)no-repeat 90% center*/;background-size: auto 100%;position: static;padding: 20px;color: #fff;">
				<div class="state-cont">
					<h3 class="h">订单状态</h3>
					<p class="sub" style="font-size: 12px;margin-top: 5px;"><?php echo ($trade["status_str"]); ?></p>
				</div>
			</div>
			<div class="block express" style="margin-top: -1px;">
				<div class="block form" style="margin-top: -1px;">
                	<div class="express-panel" style="padding: 10px 0;">
				        <ul class="express-detail">
				            <li class="clearfix">
				                <span class="name">收货人：<?php echo ($trade["receiver_name"]); ?></span><span class="tel"><?php echo ($trade["receiver_mobile"]); ?></span>
				            </li>
				            <li class="address-detail">收货地址：<?php echo ($trade["receiver_province"]); echo ($trade["receiver_city"]); echo ($trade["receiver_county"]); echo ($trade["receiver_detail"]); ?></li>
				        </ul>
				    </div>
            	</div>
			</div>
			<div class="js-order-detail">
				<!-- 商品列表 -->
				<div class="js-goods-list-container block block-list block-order ">
					<div class="header" style="padding-left: 0px;">
						<span>店铺：<?php echo ($trade["seller_nick"]); ?></span>
					</div>
					<div class="js-goods-list">
						<?php if(is_array($trade['orders'])): foreach($trade['orders'] as $i=>$product): ?><a href="/h5/goods?id=<?php echo ($product["goods_id"]); ?>" class="js-goods-item block-item name-card name-card-3col name-card-goods clearfix">
	            			<div class="thumb"><img src="<?php echo ($product["pic_url"]); ?>"></div>
	        				<div class="detail">
	    						<h3 class="l2-ellipsis"><?php echo ($product["title"]); ?></h3>
	    						<p class="c-gray ellipsis"><?php echo ($product["spec"]); ?></p>
							</div>
					        <div class="right-col">
					        	<div class="price">¥<span><?php echo ($product["price"]); ?></span></div>
					            <div class="num">×<span class="num-txt"><?php echo ($product["num"]); ?></span></div>
					        </div>
					        <div class="goods-action">
					        	<?php if(!empty($product['refund_id'])){ echo '<span class="tag tag-red tag-opt js-refund" data-oid="'.$product['oid'].'">'.$product['refund_state_str'].'</span>'; }else if($product['can_refund']){ echo '<span class="tag tag-red tag-opt js-refund" data-oid="'.$product['oid'].'">申请退款</span>'; } ?>
							</div>
	      				</a><?php endforeach; endif; ?>
						<?php $express_count = count($trade['express']); if($express_count <= 1){ if(empty($trade['express'])){ ?>
							<div class="block-item font-size-12" style="padding-left: 0px;">
						    	配送方式：<span class="pull-right"><span class="express_name"><?php echo ($trade['express_name']); ?></span>¥<?php echo ($trade["post_fee"]); ?></span>
		         			</div>
							<?php }else{ ?>
							<a class="block-item font-size-12" style="padding-left: 0px;" href="http://m.kuaidi100.com/result.jsp?nu=<?php echo ($trade['express'][0]['no']); ?>" target="_blank">
						    	<p class="has-express-no"><?php echo ($trade['express'][0]['name']); ?>：<?php echo ($trade['express'][0]['no']); ?><span class="pull-right">¥<?php echo ($trade["post_fee"]); ?></span></p>
		         			</a>
							<?php } }else{ ?>
						<table class="express-table">
  							<tbody>
  								<tr>
    								<td rowspan="<?php echo $express_count+1;?>" class="title">配送方式</td>
									<td class="block-item desc">共有<?php echo ($express_count); ?>个包裹信息，¥<?php echo ($trade["post_fee"]); ?></td>
								</tr>
								<?php if(is_array($trade['express'])): foreach($trade['express'] as $key=>$item): ?><tr>
    								<td>
    									<a class="block-item font-size-12" href="http://m.kuaidi100.com/result.jsp?nu=<?php echo ($item['no']); ?>" target="_blank">
					        				<p class="has-express-no"><?php echo ($item['name']); ?><span class="pull-right"><?php echo ($item['no']); ?></span></p>
	         							</a>
	         						</td>
  								</tr><?php endforeach; endif; ?>
							</tbody>
						</table>
						<?php } ?>
					</div>
					<?php if(($trade['buyer_remark']) != ""): ?><div class="block-item order-message">
				    	<span class="font-size-12">买家留言：</span><p class="message-content font-size-12"><?php echo ($trade['buyer_remark']); ?></p>
				    </div><?php endif; ?>
					<div class="block-item" style="line-height: 1.2;">
						合计
						<div class="pull-right">
							<span class="c-orange">¥<?php echo sprintf('%.2f', $trade['total_fee']+$trade['post_fee']);?></span>
						</div>
					</div>
				</div>
			
				<div class="block border-top-0">
					<div style="display: flex;text-align: center;border-top: 1px solid #e5e5e5;">
					  <a class="js-lxkf online-kefu" href="javascript:;" data-shop="<?php echo ($trade["seller_id"]); ?>">在线客服</a>
					  <a href="tel:<?php echo C('KEFU.FOUR_ZERO_ZERO');?>" class="online-tel">售后电话</a>
					</div>
	        	</div>

				<div class="js-order-total block border-top-0">
					<div class="block-item order-total">
						<p>
							<span>商品总价</span><span class="pull-right">¥<?php echo ($trade['total_fee']); ?></span>
						</p>
						<p>
							<span>运费(快递)</span><span class="pull-right">+ ¥<?php echo ($trade['post_fee']); ?></span>
						</p>
						<p>
							<span>店铺优惠</span><span class="pull-right">- ¥<?php echo ($trade['discount_fee']); ?></span>
						</p>
						<p>
							<span>积分抵用</span><span class="pull-right">- ¥<?php echo bcadd($trade['paid_balance'], $trade['paid_no_balance'], 2);?></span>
						</p>
					</div>
					<div class="block-item">
						<p>
							<span>应付金额</span><span class="pull-right c-orange">¥<?php echo ($trade['payment']); ?></span>
						</p>
					</div>
				</div>
	        	
	        	<div class="block" style="background-color: #fff;padding:20px 10px;line-height:22px;font-size:12px;color:#999;">
	            	<p>订单编号：<?php echo ($trade['tid']); ?></p>
	               	<p>创建时间：<?php echo ($trade['created']); ?></p>
	               	<?php if(!empty($trade['pay_time'])): ?><p>支付时间：<?php echo ($trade['pay_time']); ?></p>
	               	<?php if(!empty($trade['trade_no'])): ?><p>支付流水：<?php echo ($trade['trade_no']); ?></p><?php endif; ?>
	               	<?php if($trade['refunded_fee'] > 0): ?><p>累计退款：<?php echo ($trade['refunded_fee']); ?>元</p><?php endif; endif; ?>
	               	<?php if(!empty($trade['consign_time'])): ?><p>发货时间：<?php echo ($trade['consign_time']); ?></p><?php endif; ?>
	               	<?php if(!empty($trade['end_time'])): ?><p>成交时间：<?php echo ($trade['end_time']); ?></p><?php endif; ?>
	        	</div>
			</div>
			<?php if($trade['buyer_id'] == $login_id): ?><div class="js-bottom-action">
	               <div class="js-bottom bottom-fix">
	                  <div class="js-button-action">
	                   	<?php if($trade['status'] == 'send'){ ?>
						<span class="js-confirm-receive tag tag-big tag-orange pull-right" style="padding:0 6px;margin-right: 10px;">确认收货</span>
	                   	<?php }else if($trade['status'] == 'success' || $trade['status'] == 'cancel'){ ?>
						<span class="js-del-order tag tag-big tag-orange pull-right" style="padding:0 6px;margin-right: 10px;">删除</span>
						<?php }else{ ?>
						<span class="js-back tag tag-big tag-orange pull-right" style="padding:0 6px;margin-right: 10px;">返回</span>
						<?php } ?>
					</div>
	        	</div>
	        </div><?php endif; ?>
		</div>
	</div>
<style>
.express-content{margin-top:10px}
.express-content .block.block-order .header{padding-left: 0px;display:block}
.express-content .header:after{content:'';position:absolute;width:7px;height:7px;border-top:2px solid#cbc9cc;border-right:2px solid#cbc9cc;-webkit-transform:rotate(45deg);-moz-transform:rotate(45deg);-ms-transform:rotate(45deg);transform:rotate(45deg);top:14px;right:12px}
.express-content .header .pull-right{margin-right:16px}
.express-table{width: 100%;border-top: 1px solid #e5e5e5;font-size: 12px;}
.express-table .title{width: 15px;padding: 20px;border-right: 1px solid #F8F8F8;}
.express-table .desc{text-align: center;border-top: none;}
.express-table .block-item{border-color:#F8F8F8}
.express_name{color:#999}
.has-express-no{line-height:20px;margin-right: 10px}
.has-express-no:after{content:'';position:absolute;width:7px;height:7px;border-top:2px solid #cbc9cc;border-right:2px solid #cbc9cc;-webkit-transform:rotate(45deg);-moz-transform:rotate(45deg);-ms-transform:rotate(45deg);transform:rotate(45deg);top:16px;right:12px}
.online-kefu{flex: 1;height:35px;line-height:35px;border-right: 1px solid #e5e5e5;}
.online-kefu:before{content:'';background:url('https://open.weixin.qq.com/zh_CN/htmledition/res/assets/res-design-download/icon32_wx_logo.png') no-repeat;width:18px;height:18px;display:inline-block;background-size:100%;margin-bottom:-5px;margin-right:3px;}
.online-tel{flex: 1;height:35px;line-height:35px;}
.online-tel:before{content:'';background:url('/img/mall/phone_aaaa.jpg') no-repeat;width:18px;height:18px;display:inline-block;background-size:100%;margin-bottom:-5px;margin-right:3px;}
</style>
</body>
	<script type="text/javascript">
	var tid = '<?php echo ($trade["tid"]); ?>';
	require(["jquery"], function(){
		$('.js-button-action')
		.on('click', '.js-del-order', function(){
			if(!confirm("确定删除订单吗？")){
				return false;	
			}
			
			$.ajax({
				url: '/h5/order/delete',
				dataType: 'json',
				data: {tid: tid},
				type: 'post',
				success: function(){
					window.history.back();
				}
			});
		})
		.on('click', '.js-confirm-receive', function(){
			if(!confirm('确认收货吗？没有收到物品前请勿此操作')){
				return false;
			}
			
			$.ajax({
				url: '/h5/order/sign',
				dataType: 'json',
				data: {tid: tid},
				type: 'post',
				success: function(){
					window.location.reload();
				}
			});
		})
		.on('click', '.js-back', function(){
			window.history.back();
		});
		
		$('.js-refund').on('click', function(){
			var oid = $(this).data('oid');
			$.ajax({
				url: '/h5/refund?oid='+oid,
				waitting: true,
				success: function(html){
					$('body').append(html);
				}
			});
			return false;
		});
	});
	</script>
</html>